import icon from 'assets/img/image.jpg'
import icon1 from 'assets/img/image2.jpg'
import icon2 from 'assets/img/image3.jpg'
const mobileValidator = async (rule, value) => {
  if (!value) {
    return Promise.reject('请输入手机号')
  } else if (!/^1[3456789]\d{9}$/.test(value)) {
    return Promise.reject('手机格式不正确，请重新输入')
  } else {
    return Promise.resolve()
  }
}

/* 弹窗表单 */
export const FORM_CONFIG_COMMON = [
  {
    type: 'input',
    key: 'name',
    label: '姓名',
    defaultValue: '就是这么嚣张',
    attrs: {
      maxlength: 10
    },
    required: true,
    col: 12
  },
  {
    type: 'number',
    key: 'phone',
    label: '电话',
    req: true,
    attrs: {
      style: 'width:100%'
    },
    validator: mobileValidator,
    col: 12
  },
  {
    type: 'textarea',
    key: 'content',
    label: '备注',
    disabled: true,
    defaultValue: ' 这是一段小备注'
  },
  {
    type: 'radio',
    key: 'sex',
    label: '性别',
    custom: { label: 'content', value: 'code' },
    defaultValue: 1,
    data: [
      { content: '男', code: 1 },
      { content: '女', code: 0 }
    ]
  },
  {
    type: 'checkbox',
    key: 'game',
    label: '游戏',
    custom: { label: 'content', value: 'code' },
    data: [
      { content: '游戏1', code: 1 },
      { content: '游戏2', code: 0 }
    ]
  },
  {
    type: 'select',
    key: 'hobby',
    label: '爱好',
    required: true,
    data: [
      { label: '篮球', value: 1 },
      { label: '足球', value: 0 }
    ],
    attrs: {
      allowClear: true
    }
  },
  {
    type: 'date',
    key: 'qqq',
    label: '生日',
    // hide: true
    hide: data => data.sex == 1
  },
  {
    type: 'daterange',
    key: 'www',
    label: '活动时间'
  }
  // {
  //     type: 'slot',
  //     slotName: 'content',
  //     key: 'slot',
  //     label: ' 超操一个'
  // }
]

/* 通用表单 */
export const FORM_CONFIG = [
  {
    type: 'a-input',
    key: 'name',
    label: '姓名',
    defaultValue: '就是这么嚣张',
    required: true,
    disabled: false,
    col: 12,
    attrs: {
      placeholder: '请输入'
    }
  },
  {
    type: 'a-input',
    key: 'phone',
    label: '电话',
    validator: mobileValidator,
    col: 12,
    attrs: {
      placeholder: '请输入电话'
    }
  },
  {
    type: 'a-textarea',
    key: 'content',
    label: '备注',
    disabled: true,
    defaultValue: '这是一段小备注'
  },
  {
    type: 'a-radio-group',
    key: 'sex',
    label: '性别',
    custom: { label: 'content', value: 'code' },
    defaultValue: 1,
    options: [
      { label: '男', value: 1 },
      { label: '女', value: 0 }
    ]
  },
  {
    type: 'a-checkbox-group',
    key: 'game',
    label: '游戏',
    custom: { label: 'content', value: 'code' },
    options: [
      { label: '游戏1', value: '游戏1' },
      { label: '游戏2', value: 0 }
    ],
    required: true
  },
  {
    type: 'a-select',
    key: 'hobby',
    label: '爱好',
    required: true,
    isShow: data => data.sex == 1,
    attrs: {
      allowClear: true
    },
    options: [
      { label: '篮球', value: '篮球' },
      { label: '足球', value: '足球' }
    ]
  },
  {
    type: 'a-select',
    key: 'xix',
    label: '兴趣',
    required: true,
    options: [
      { label: '唱', value: '0' },
      { label: '跳', value: '1' },
      { label: 'rap', value: '1' }
    ],
    attrs: {
      allowClear: true
    }
  },
  {
    type: 'a-date-picker',
    key: 'qqq',
    label: '生日',
    required: true
  },
  {
    type: 'a-range-picker',
    key: 'www',
    label: '活动时间',
    required: true,
    // bug
    attrs: {
      placeholder: ['开始时间', '结束时间']
    }
  }
  // {
  //     type: 'slot',
  //     slotName: 'content',
  //     key: 'slot',
  //     label: ' 超操一个'
  // }
]

/* 下拉框 */
export const OPTIONS = [
  {
    value: '',
    label: 'All'
  },
  {
    value: 'Option1',
    label: 'Option1'
  },
  {
    value: 'Option2',
    label: 'Option2'
  },
  {
    value: 'Option3',
    label: 'Option3'
  }
]

/* 走马灯 */
export const SWIPER_DATA = [
  {
    id: '1',
    url: icon2,
    title: '2021402143期',
    star: 3,
    period: '21',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },

  {
    id: '2',
    url: icon2,
    title: '2021402144期',
    star: 4,
    period: '22',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },
  {
    id: '3',
    url: icon2,
    title: '2021402145期',
    star: 5,
    period: '23',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },
  {
    id: '4',
    url: icon,
    title: '2021402146期',
    star: 4,
    period: '24',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },
  {
    id: '5',
    url: icon,
    title: '2021402147期',
    star: 3,
    period: '25',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },
  {
    id: '6',
    url: icon1,
    title: '2021402147期',
    star: 3,
    period: '25',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },
  {
    id: '7',
    url: icon1,
    title: '2021402147期',
    star: 3,
    period: '25',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },
  {
    id: '8',
    url: icon,
    title: '2021402147期',
    star: 3,
    period: '25',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },
  {
    id: '9',
    url: icon,
    title: '2021402147期',
    star: 3,
    period: '25',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },
  {
    id: '10',
    url: icon,
    title: '2021402147期',
    star: 3,
    period: '25',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  },

  {
    id: '11',
    url: icon,
    title: '2021402147期',
    star: 3,
    period: '25',
    time: '2023.02.02-2023.02.03',
    stu: '26',
    teacher: ['王老师', '赵老师']
  }
]

/* 表格 */
export const COLUMNS = [
  {
    label: '日期',
    key: 'date',
    width: 120
  },
  {
    label: '姓名',
    key: 'name',
    width: 80
  },
  {
    label: '状态',
    key: 'state',
    width: 80
  },
  {
    label: '城市',
    key: 'city',
    width: 80
  },
  {
    label: '地址',
    key: 'address',
    width: 80
  },
  {
    label: '编号',
    key: 'zip',
    width: 80
  }
]

export const TABLE_DATA = [
  {
    date: '2016-05-03',
    name: 'Tom',
    state: 'California',
    city: 'Los Angeles',
    address: 'No. 189, Grove St, Los Angeles',
    zip: 'CA 90036',
    tag: 'Home',
    test: 'test'
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    state: 'California',
    city: 'Los Angeles',
    address: 'No. 189, Grove St, Los Angeles',
    zip: 'CA 90036',
    tag: 'Office',
    test: 'test'
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    state: 'California',
    city: 'Los Angeles',
    address: 'No. 189, Grove St, Los Angeles',
    zip: 'CA 90036',
    tag: 'Home',
    test: 'test'
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    state: 'California',
    city: 'Los Angeles',
    address: 'No. 189, Grove St, Los Angeles',
    zip: 'CA 90036',
    tag: 'Office',
    test: 'test'
  }
]

/* 上传图片 */
export const FILE_LIST = [
  {
    name: 'food.jpeg',
    url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
  },
  {
    name: 'plant-1.png',
    url: '/images/plant-1.png'
  },
  {
    name: 'food.jpeg',
    url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
  },
  {
    name: 'plant-2.png',
    url: '/images/plant-2.png'
  },
  {
    name: 'food.jpeg',
    url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
  },
  {
    name: 'figure-1.png',
    url: '/images/figure-1.png'
  },
  {
    name: 'food.jpeg',
    url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
  },
  {
    name: 'figure-2.png',
    url: '/images/figure-2.png'
  }
]
